Video Commands


MMB comes with video playback support, and main features are:

  •   Video playback of following formats:
      AVI, QT, MOV, MPG, MPEG, M1V, ASX, ASF, WMV
  •   Video positioning
  •   Setting of video speed and size

 Supported Video scripting commands:

VideoLoad("ObjectLabel","Path")
Description
 


Opens video file (create still image) specified as a command parameter.

Use first parameter to set video object label, for example:

VideoBox

Second parameter sets file to load and requires either

a) folder path + video file name, or
b) path macro + video file name

Code Examples
 

**Play file Intro.avi from folder c:\My Project in video object
**labeled "VideoBox"

VideoLoad("VideoBox","c:\My Project\Intro.avi")

**Play file Intro.avi from <SrcDir> folder in video object
**labeled "VideoBox"

VideoLoad("VideoBox","<SrcDir>\Intro.avi")

Additional Info
 

Use CBK contants to retrieve info on opened video file.

If file has not been specified as a command parameter, MMB will display Open File dialog box.

If VideoLoad refuse to create a Still Image from the loaded video, try increase the Color Depth in Display settings.

With VideoLoad you can not only load Video files, but also some audio formats! For deatiled list of supported audio formats check this page.

 

VideoClose("ObjectLabel")
Description
 


Close Video (unload it from memory) and Hide the video object (Hide still image of video). The same functionality as Close&Hide option in Video Properties (After Video Finish event).

Use first parameter to set video object label, for example:

VideoBox

Code Examples
 

**Close video and hide the still image.
VideoClose("Video")

Additional Info
 

Use CBK contants to retrieve info on opened video file.

If file has not been specified as a command parameter, MMB will display Open File dialog box.

With VideoLoad you can not only load Video files, but also some audio formats! For deatiled list of supported audio formats check this page.

 

VideoPlay("ObjectLabel")
Description
 


Plays video file in a video object specified as a command parameter.

If video object is labeled:

VideoWindow

...then it's label put into command will look like this:

VideoPlay("VideoWindow")

Code Example
 

**Play video file loaded in object labeled "VideoWindow":
VideoPlay("VideoWindow")

Additional Info
 

Use CBK contants to retrieve info on opened video file.

Prior to playing, video file must be loaded using VideoLoad command.

 

VideoPause("ObjectLabel")
Description
 


Pauses or plays video.

If playback has been paused/stopped, it will be resumed. Otherwise playback is paused.

Useful when making one button for play/pause functions.


Object that video should be paused for is specified as a command parameter. If video object is labeled:

VideoWindow

...then it's label put into command will look like this:

VideoPause("VideoWindow")

Code Example
 

**Pause/resume video in object labeled "VideoWindow":
VideoPause("VideoWindow")

 

VideoStop("ObjectLabel")
Description
 


Stops video in object specified as a command parameter.

If video object is labeled:

VideoBox

...then it's label put into command will look like this:

VideoStop("VideoBox")

Code Example
 

**Stop video in object labeled "VideoBox":
VideoStop("VideoBox")

 

VideoRewind("ObjectLabel","Parameters")
Description
 


Rewinds video, opened and played by VideoOpen and VideoPlay commands, to a given position.

Position format depends on settings of VideoParam command, so positioning can be performed either in milliseconds or frames.

Use first parameter to set video object label, for example:

VideoBox

Second command parameter sets video position in frames or milliseconds:

3214

To use relative rewinding set:

RELATIVE

...as a third command parameter. In this case, second parameter makes offset positioning, so for example moving video 120 frames forward is represented as positive number:

120

...and moving video 120 frames backwards is represented as negative number:

-120

Notice that parameters in this command are not separated with double quotes, but with commas, so here's example of complete command:

VideoRewind("VideoBox","-120,RELATIVE")

Video positioning is not available for all video formats.

Code Examples
 

**Set video position in object "VideoBox" to 25th second:
**(VideoParam Mode must be set to TIME)
VideoRewind("VideoBox","25000")

**Set video position in object "VideoBox" to a frame 7328:
**(VideoParam Mode must be set to FRAME)

VideoRewind("VideoBox","7328")

**Set relative video position in object "VideoBox" forward for 5 seconds:
**(VideoParam Mode must be set to TIME)

VideoRewind("VideoBox","7328,RELATIVE")

**Set relative video position in object "VideoBox" backward for
**180 frames (VideoParam Mode must be set to TIME)

VideoRewind("VideoBox","-180 ,RELATIVE")

Additional Info
 

Learn about Matrix object to create a video seek bar.

 

VideoSpeed("ObjectLabel","Parameters")
Description
 


Sets playback speed of video opened by VideoOpen command.

Use first parameter to set video object label, for example:

VideoBox

Second command parameter sets video speed either as a fixed parameter or through numerical variable, in range:

0 - 2000

Default playback rate is 1000. Setting rate below default will lower playback rate, raising it above default will set higher playback rate.


To use relative setting of playback rate set:

RELATIVE

...as a third command parameter. In this case, second parameter makes setting of playback rate relative to current rate, so for example raising playback rate for 200 is represented as a positive number:

200

...and lowering playback rate for 200 is represented as negative number:

-200

Notice that parameters in this command are not separated with double quotes, but with commas, so here's example of complete command:

VideoSpeed("VideoBox","-200,RELATIVE")

Changing of playback rate is not available for all video formats.

Code Examples
 

**Set video playback rate in object "VideoBox" to 1500:
VideoSpeed("VideoBox","1500")

**Raise relative video playback rate in object "VideoBox" for 200:
VideoSpeed("VideoBox","200,RELATIVE")

**Lower relative video playback rate in object "VideoBox" for 200:
VideoSpeed("VideoBox","-200,RELATIVE")

Additional Info
 

Learn about Matrix object to create a playback rate gauge.

 

VideoScale("ObjectLabel","Width,Height")
Description
 


Sets video object size.

Use first parameter to set video object label, for example:

VideoBox

Second command parameter sets width of video object, for e.g.:

640

Third command parameter sets height of video object, for e.g.:

480

Notice that parameters in this command are not separated with double quotes, but with commas, so here's an example of complete command:

VideoScale("VideoBox","640,480")

Code Example
 

**Set video in object "VideoBox" to 320 (width) x 240 (height):
VideoParam("VideoBox","320,240")

 

VideoParam("ObjectLabel","Parameters")
Description
 


Sets additional parameters for video object.

Use first parameter to set video object label, for example:

VideoBox

Second command parameter sets following video object properties:

FULLSCREEN - uses ON/OFF switch to set FullScreen mode of video:

  • FULLSCREEN=ON : sets video fullscreen on
  • FULLSCREEN=OFF : sets video fullscreen off

LOOP - uses ON/OFF switch to set repeating of video:

  • LOOP=ON : sets video looping on
  • LOOP=OFF : sets video looping off

MUTE - uses ON/OFF switch to set sound mute for video object:

  • MUTE=ON : sets audio muting on
  • MUTE=OFF : sets audio muting off

Set the video either to time or frame format:

  • TIME : sets time mode
  • FRAME : sets frame mode
Code Examples
 

**Set video in object "VideoBox" to full screen:
VideoParam("VideoBox","FULLSCREEN=ON")

**Turn looping on for video in object "VideoBox":
VideoParam("VideoBox","LOOP=ON")

**Turn muting on for video in object "VideoBox":
VideoParam("VideoBox","MUTE=ON")

**Set frame mode for video in object "VideoBox":
VideoParam("VideoBox","FRAME")

Additional Info
 

CBK_VTime returns current time only if VideoParam is set to TIME and VFrame returns current frame only if VideoParam is set to FRAME. You can't use FRAME and TIME at the same time!

VideoParam is by default set to TIME.

If CBK_VTotalFrames returns 0 after loading the video, it means that video doesn't support frames so you won't be able to position video by frames using Video Skip FW/BW commands (in "Interaction with other objects") or using VideoRewind command (with pre-defined VideoParam("VideoBox","FRAME") settings).

 


MMB Scripting Unleashed by Bokzy, 2003 :: All rights reserved :: http://www.bokzy.com